<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title></title>

    <#include "/commons/stylesheets.ftl">

    <!-- Data Tables -->
    <link href="bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="/layer/skin/layer.css" rel="stylesheet">
    <style type="text/css">
        #toolbar button {
            margin-right: 10px;
        }
    </style>
    <script type="text/javascript">

        function search(){
            $("#table").bootstrapTable("refresh",{query:serializeForm("#form")});
        }

        function cancelBind(){
            var  rows = $("#table").bootstrapTable("getSelections");
            if(rows.length == 0){
                layer.msg("请选择一条记录");
                return false;
            }
            var customerIds = $.map(rows,function(row){ return row.customId});
            var activityId = $("#activityId").val();
            var handleResponse = function(resp){
                    if (resp.resultCode == "success") {
                        layer.msg('解绑成功');
                        search();
                    } else {
                        layer.msg('解绑失败');
                    }
                };
                $.ajax({
                   url:"activity/cancelCustomerActivity",traditional:true,data:{activityId:activityId,customerIds:customerIds},type:'post',success:handleResponse
               });

        }

    </script>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form id="form" class="form-inline">
                            <input type="hidden" id="activityId" name="activityId" value="${activityId}" />
                            <input type="hidden" id="activityTargetType" name="activityTargetType" value="${activityTargetType!''}" />
                                <div class="row">
                                    <div class="form-group" id="dataRange">
                                        <label class="control-label">注册时间</label>

                                        <div class="input-daterange input-group" stype="text-align:left;" id="datepicker">
                                            <input type="text" class="input-sm form-control" id="registerStart" name="registerStart" />
                                            <span class="input-group-addon">到</span>
                                            <input type="text" class="input-sm form-control" id="registerEnd" name="registerEnd" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label">性别：</label>
                                       <select name="gender" id="gender" class="form-control" >
                                           <option value=""></option>
                                           <option value="男">男</option>
                                           <option value="女">女</option>
                                       </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label">年龄：</label>
                                        <select name="age" id="age" class="form-control" >
                                            <option value=""></option>
                                            <#list ageEnum as val>
                                                 <option value="${val}">${val}</option>
                                            </#list>
                                        </select>
                                    </div>
                                </div>
                            </form>
                            <div id="toolbar">
                                <button class="btn btn-primary" type="button" style="margin-left: 20px;" onclick="search()">搜索</button>
                                <#if "${isShowButton!'0'}"=="1">
                                    <button class="btn btn-primary" type="button" style="margin-left: 20px;" onclick="cancelBind()">解绑用户</button>
                                 </#if>
                            </div>
                        <table id="table"
                               data-toolbar="#toolbar"
                               data-data-field="list"
                               data-search="false"
                               data-show-refresh="false"
                               data-show-columns="false"
                               data-show-export="false"
                               data-side-pagination="server"
                               data-pagination="true"
                               data-page-size="15"
                               data-url="${rc.contextPath}/customerVehicle/queryActivityCustomer?activityId=${activityId}&activityTargetType=${activityTargetType!''}"
                               >
                            <thead>
                                <tr>
                                    <th data-checkbox="true">id</th>
                                    <th data-field="middleName">用户昵称</th>
                                    <th data-field="customerTel">电话</th>
                                    <th data-field="vehicleBrand">品牌</th>
                                    <th data-field="vehicleSeries">车型</th>
                                    <th data-field="vehicleLicense">车牌</th>
                                    <th data-field="userVerifyTime">参与时间</th>
                                    <th data-field="companyVerifyTime">验证时间</th>
                                </tr>
                            </thead>
                            <tbody>

                            </tbody>

                        </table>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <#include "/commons/scripts.ftl">
    <script src="js/app.js"></script>
    <script src="/layer/layer.js"></script>

    <script type="text/javascript" src="/bootstrap-table/bootstrap-table.min.js"></script>
    <script type="text/javascript" src="/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <!-- Data picker -->
    <script src="/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <!-- Page-Level Scripts -->
    <script>
        $(function(){
            $("#table").bootstrapTable({locale:'zh-CN'}) ;

            $("#dataRange .input-daterange").datepicker({
                keyboardNavigation:false,
                forceParse:false,autoclose:true
            });
        });
    </script>

    
    <!--统计代码，可删除-->

</body>

</html>